/*
 * Copyright 2010 Adam Ruggles
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package saig.engine.models.enums;

/**
 * TileType Enum, defines the type property of tiles.
 * @author Adam
 * @version $Id$
 *
 * Created on Jun 9, 2010 at 6:44:11 PM
 */
public enum TileType {
    PASSABLE(0),
    IMPASSABLE(1),
    PLATFORM(2),
    BREAKABLE(3),
    BUMPABLE(4),
    COIN(5),
    HIDDEN(5);
	/**
	 * Returns a TileType from it's integer value.
	 * @param value The value of the tile type.
	 * @return A TileType from it's integer value.
	 */
	public static TileType fromInt(final int value) {    
		switch(value) {
            case 0:
            	return PASSABLE;
            case 1:
            	return IMPASSABLE;
            case 2:
            	return PLATFORM;
            case 3:
            	return BREAKABLE;
            case 4:
            	return BUMPABLE;
            case 5:
            	return COIN;
            case 6:
            	return HIDDEN;
            default:
            	return null;
        }
	}
    /**
     * The tile value.
     */
    private final int value;
    /**
     * Private TileType constructor.
     * @param value The value associated with the tile type.
     */
    private TileType(final int value) {
    	this.value = value;
    }
	/**
	 * Returns the integer value of the tile type.
	 * @return The integer value of the tile type.
	 */
	public int toInt() {
		return value;
	}
	/**
	 * Returns a string representation of the tile type.
	 * {@inheritDoc}
	 * @see java.lang.Enum#toString()
	 */
	public String toString() {
		switch(this) {
		case PASSABLE:
			return "Passable";
		case IMPASSABLE:
			return "Impassable";
		case PLATFORM:
			return "Platform";
		case BREAKABLE:
			return "Breakable";
		case BUMPABLE:
			return "Bumpable";
		case COIN:
			return "Coin";
		case HIDDEN:
			return "Hidden";
		default:
			return "Unkown";
		}
	}
}
